﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace 物流管理系统
{
    public partial class Functionform : Form
    {
        static DBOperation dboperation = new DBOperation();
        public Functionform()
        {
            InitializeComponent();
        }
        private void 货物信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Infoqueryform queryform = new Infoqueryform();
            queryform.tableselect=0;
            queryform.ShowDialog();
        }

        private void 车辆信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Infoqueryform queryform = new Infoqueryform();
            queryform.tableselect=1;
            queryform.ShowDialog();
        }

        private void 客户信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Infoqueryform queryform = new Infoqueryform();
            queryform.tableselect=2;
            queryform.ShowDialog();
        }

        private void 驾驶员信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Infoqueryform queryform = new Infoqueryform();
            queryform.tableselect=3;
            queryform.ShowDialog();
        }

        private void 会员类型信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Infoqueryform queryform = new Infoqueryform();
            queryform.tableselect=4;
            queryform.ShowDialog();
        }

        private void 用户信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Infoqueryform queryform = new Infoqueryform();
            queryform.tableselect=5;
            queryform.ShowDialog();
        }

        private void 托运信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Infoqueryform queryform = new Infoqueryform();
            queryform.tableselect=6;
            queryform.ShowDialog();
        }

        private void 装车管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Infoqueryform queryform = new Infoqueryform();
            queryform.tableselect=7;
            queryform.ShowDialog();
        }

        private void 发车管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Infoqueryform queryform = new Infoqueryform();
            queryform.tableselect=8;
            queryform.ShowDialog();
        }

        private void 收货管理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Infoqueryform queryform = new Infoqueryform();
            queryform.tableselect=9;
            queryform.ShowDialog();
        }

        private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Aboutsystemform aboutsystemform = new Aboutsystemform();
            aboutsystemform.ShowDialog();
        }

        private void returntologin_Click(object sender, EventArgs e)
        {
            Loginform loginform = new Loginform();
            Hide();
            loginform.ShowDialog();
            Close();
        }

        private void quit_Click(object sender, EventArgs e)=> Close();

        private void Functionform_Load(object sender, EventArgs e)
        {
        }
        public void setpowerlist(string s)
        {
            List<string> querypowerlist = dboperation.queryalllist("select * from 用户信息表 where 用户编号='"+s+"'", 21);
            string[] usercolumns = { "用户编号", "用户密码", "货物信息管理权限", "车辆信息管理权限", "客户信息管理权限", "驾驶员信息管理权限", "会员类型信息管理权限", "用户信息管理权限", "托运信息登记权限", "查看托运信息权限", "装车登记权限", "查看装车信息权限", "修改装车信息权限", "发车登记权限", "车辆到达登记权限", "车辆返回登记权限", "查看发车信息权限", "修改发车信息权限", "到货登记权限", "到货确认权限", "修改到货信息权限" };
            for (int i = 0; i<querypowerlist.Count; i++)
            {
                if (querypowerlist[i].Equals("1"))
                {
                    powerlist.Items.Add(usercolumns[i]);
                }
            }
        }
    }
}
